package com.example.demo.filter2;

import com.example.demo.filter2.TestFilter3;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName FilterConfig
 * @Description: 修改请联系我，否则请勿随意修改
 * @Author ChenYuan
 * @Date 2021/4/30
 * @Version V1.0
 **/
@Configuration
public class FilterConfiguration {
    @Bean
    public FilterRegistrationBean testFilter3RegistrationBean() {
        FilterRegistrationBean registration = new FilterRegistrationBean(new TestFilter3());
        registration.addUrlPatterns("/user/put","/user/info");
        registration.setOrder(2); // 值越小越靠前，此处配置有效
        return registration;
    }

    @Bean
    public FilterRegistrationBean testFilter4RegistrationBean() {
        FilterRegistrationBean registration = new FilterRegistrationBean(new TestFilter4());
        registration.addUrlPatterns("/user/put","/user/info");
        registration.setOrder(1);
        return registration;
    }
}
